package servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import vo.InserirPedido;
import dao.PedidoDao;

/**
 * Servlet implementation class ListPedidosServlet
 */
@WebServlet("/ListPedidosServlet")
public class ListPedidosServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ListPedidosServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  	  
	    
	    PedidoDao pedidoDao = new PedidoDao();
	    List<InserirPedido> pedidos = pedidoDao.getPedidos(	);
	  
	    		
	    request.setAttribute("pedidos", pedidos);
	    getServletContext().getRequestDispatcher( "/relatorioPed.jsp").forward(request, response);
	  }

}
